<% layout('/layout/default.html', {title: '个人中心', libs: ['validate']}){ %>
<div class="main-content">
	<div class="container-fluid">
		<div class="card-header">
			<div class="box-title">
				<i class="fa fa-sitemap"></i>修改密码
			</div>
		</div>
		<form id="inputForm" class="form-horizontal" action="${ctx}/sys/user/modifyPwdData" method="post">
			<a href="${ctx}/logout" ><span id="logout"></span></a>
			<div class="card-body">
				<div class="row">
					<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
						<div class="form-group row">
							<label class="col-form-label col-lg-4 col-md-4 text-right" title="旧密码">
								<span style="color:red;" aria-required="true">*</span> 旧密码: <i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<input id="oldPassword" name="oldPassword" type="password" value="" maxlength="50" minlength="3" class="form-control form-control-sm required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
						<div class="form-group row">
							<label class="col-form-label col-lg-4 col-md-4 text-right" title="新密码">
								<span style="color:red;" aria-required="true">*</span> 新密码:<i class="fa icon-question hide"></i>
							</label>
							<div class="col-sm-8">
								<input id="newPassword" name="newPassword" type="password" value="" maxlength="50" minlength="3" class="form-control form-control-sm required" noEqualTo="#oldPassword"/>
							</div>
						</div>
					</div>
				</div>
			
				<div class="row">
					<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
						<div class="form-group row">
							<label class="col-form-label col-lg-4 col-md-4 text-right" title="类型">
								<span style="color:red;" aria-required="true">*</span> 确认新密码<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<input id="confirmNewPassword" name="confirmNewPassword" type="password" value="" maxlength="50" minlength="3" class="form-control form-control-sm required" equalTo="#newPassword"/>
							</div>
						</div>
					</div>
				</div>
				
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="offset-md-2 col-md-10">
						<div class="form-group">
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> 保 存</button>
							<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="window.parent.closeCurrentTabPage();"><i class="fa fa-reply-all"></i> 关 闭</button>
						</div>
					</div>
				</div>
			
			</div>
		</form>
	</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
	submitHandler: function(form){

		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == 'true'){
				$('#logout').click();
			}
		});
	}
});
</script>
